<?php
/**
 * Created by IntelliJ IDEA.
 * User: wanglu
 * Date: 17/4/12
 * Time: 17:43
 */
class Project_lang_version_model extends BaseModel {

    function __construct()
    {
        parent::__construct(Db_model::TABLE_PROJECT_LANG_VERSION);
    }

    public function get_max_version($pid, $lang_id) {
        $version = $this->db->select_max('version')
            ->where('pid', $pid)
           -> where('lang_id', $lang_id)
            ->get($this->recordTable)
            ->row_array();

        if (empty($version)) {
            return 0 ;
        }
        return $version['version'];
    }
}